/*!
 * Creative App Preview.
 * Date: 2015/12/31.
 * Copyright© 2014-2015 Vamaker All Rights Reserved.
 */
require([
  'jquery',
	'pageInit',
  'materialPreview',
  'flowplayer'
], function ($, vamakerPage, MaterialPreview, flowplayer) {
  $(function() {
    var videoPluginUrl = VAM.getVar('VIDEO_PLUGIN_URL'),
      $creativePreviewWrap = $('.creative-preview-wrap'),
      width = $('.creative-width').val(),
      height = $('.creative-height').val(),   
      type = $('.creative-type').val(),
      url = $('.creative-url').val(),
      materialId = $('.creative-id').val(),
      info = {};
    info = {
      'width': width,
      'height': height,
      'type': type,
      'address': url
    };
    // console.log(VAM.getVar('MATERIAL_LIST_URL'));
    MaterialPreview.previewSingle($('.creative-preview-wrap'), info, materialId);
    $('.creative-preview-wrap').find('.flowplayer').flowplayer({
      swf: videoPluginUrl,
      engine: 'flash',
      muted: true,
      preload: 'metadata',
      tooltip: false,
      volume: 0.3
    });
  });
});
